package lipengfei.botaiframework.security.jwt.validator.impl;


import com.auth0.jwt.interfaces.DecodedJWT;

import lipengfei.botaiframework.jwt.JwtProperties;
import lipengfei.botaiframework.jwt.JwtUtil;
import lipengfei.botaiframework.security.jwt.exception.JWTException;
import lipengfei.botaiframework.security.jwt.properties.JwtTokenProperties;
import lipengfei.botaiframework.security.jwt.validator.ValidationResult;
import lipengfei.botaiframework.security.jwt.validator.Validator;
import lipengfei.botaiframework.security.jwt.validator.ValidatorModel;
import lipengfei.botaiframework.security.jwt.validator.eunm.ValidationState;



public class SignatureValidator implements Validator<ValidatorModel> {

    public ValidationResult validate(ValidatorModel validatorModel) throws JWTException {
    	 JwtProperties jwtProperties=JwtTokenProperties.buildJwtProperties();
    	 if(!JwtUtil.verifyIgnoreExpiresAt(jwtProperties, validatorModel.getToken())){
    		 return new ValidationResult(true, ValidationState.ERROR);
    	 }else {
        	 return null;
         }
    }

    
}
